<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    let arr = [
      { name: 1, id: 0 },
      { name: 3, id: 1 },
      { name: 2, id: 2 },
      { name: 3, id: 3 },
      { name: 2, id: 4 },
      { name: 1, id: 5 },
      { name: 3, id: 6 }
    ]
    let arr0 = []
    arr.forEach((val, i) => {
      arr0.push(val.name)
    })
    
    var _arr0 = [...new Set(arr0)]
    _arr0.forEach((val, i) => {
      let arr_ = []
      arr.forEach((v, index) => {
        if (v.name === val) {
          arr_.push(v)
        }
      })
      console.log(arr_);
      _arr0[i] = arr_
      // return
    })
    console.table(_arr0);

  </script>
</body>

</html>

